var commonData={
	isLogin:false,
	monthList:monthData,
	shopLoginState:0,
	shopTypeList:shopTypeData,
	memberCenterMenuList:memberCenterMenuData,
	utilitiesList:utilitiesData,
	footerNavList:footerNavData,
	accountSettingsList:accountSettingsData
};

Vue.component('sys-menu-left', {
	props:['menudata'],
	template:"<div class='sys-menu-left'>"+
	"<div class='sys-menu-one' v-for='(item,index) in menudata'>"+
		"<h3 v-if='item.isMenu' class='sys-menu-title' :class='{noBc:index==0}' @click='foldDo($event)'>"+
			"<i class='iconfont menu-icons' :class='item.icons'></i>"+
			"<div class='menu-title'>{{item.title}}</div>"+
			"<i class='iconfont icon-jiantou-down menu-arrow'></i>"+
		"</h3>"+
		"<div v-if='item.childNav' class='sys-menu-sub'>"+
			"<a v-for='itemSub in item.childNav' :id='itemSub.id' :href='itemSub.linkAddress' class='ellipsis' :class='{on:itemSub.isSelected}' :title='itemSub.title'>{{itemSub.title}}</a>"+
		"</div>"+
	"</div>"+
	"</div>",
	methods:{
		foldDo:function(ev){
			$(ev.currentTarget).toggleClass("open");
			$(ev.currentTarget).parent().find(".sys-menu-sub").slideToggle();
		}
	},
	mounted:function(){
		var str=window.location.href;
		var isChildNav3=false;
		for(var index in this.menudata){
			//二级菜单
			var childNav2=this.menudata[index].childNav;
			if(childNav2!=null){
				for(var indexSub in childNav2){
					//当前链接文本（二级）
					var currTxt2=childNav2[indexSub].linkAddress;
					if(str.indexOf(currTxt2)>=0){
						childNav2[indexSub].isSelected=true;
						isChildNav3=true;
						return;
					}else{
						childNav2[indexSub].isSelected=false;
					}
					
					var childNav3=childNav2[indexSub].childNav;
					//是否三级
					if(childNav3!=null){
						for(var indexSub1 in childNav3){
							var currTxt3=childNav3[indexSub1].linkAddress;
							if(str.indexOf(currTxt3)>=0){
								//当前父级ID（三级）
								var currTxt3Id=childNav3[indexSub1].parentId;
								if(childNav2[indexSub].id.indexOf(currTxt3Id)>=0){
									$("#"+currTxt3Id).addClass("on");
									return;
								}
								childNav3[indexSub1].isSelected=true;
								isChildNav3=true;
								return;
							}else{
								childNav3[indexSub1].isSelected=false;
							}
						}
					}
				}
			}
		}
	}
});